﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;
using System.Data;
using System.Threading;
using System.Globalization;

public partial class adminsettings : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DataSet ds = DB.getdata("Select * from adminsettings");
            if (ds.Tables[0].Rows.Count > 0)
            {
                Editor1.Content = ds.Tables[0].Rows[0]["banner"].ToString();
            }
        }
    }
    protected override void InitializeCulture()
    {
        if (Session["CurrentCulture"] != null)
        {
            string lang = Session["CurrentCulture"].ToString();
            if (lang != null && lang != "")
            {
                Thread.CurrentThread.CurrentUICulture = new CultureInfo(lang);
                Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(lang);


            }
        }

    }
    protected void SaveButton_Click(object sender, EventArgs e)
    {
        string content = Editor1.Content;
       
        List<string> fields = new List<string>();
        ArrayList values = new ArrayList();
        List<string> types = new List<string>();

       

        /////////////////////////////
        fields.Add("banner");
        types.Add("string");
        values.Add(content);


        DataSet ds = DB.getdata("Select * from adminsettings");
        if (ds.Tables[0].Rows.Count > 0)
        {
         
            DB.UPDATE("adminsettings", "int,id," + ds.Tables[0].Rows[0]["id"].ToString(), fields, types, values);
        }
        else
        {

            DB.INSERT("adminsettings", fields, types, values);
        }


        this.Cache.Remove("newsbar");
        
    }
}